package models.common.entity;

import java.util.Date;

import javax.persistence.Entity;
import javax.persistence.Transient;

import models.common.entity.t_batch_upload.UploadStatus;

import play.db.jpa.Model;

import common.constants.ConfConst;
import common.constants.Constants;
import common.utils.Security;


/**
 * 大数据智能分析报告记录表
 *@author LiangQiongfeng
 *@version 2018-1-20 下午3:01:52
 */
@Entity
public class t_finance_record extends Model {
	
	 /**
     *  文件名称
     */
    public String file_name;

    /**
     * 授信申请人id 
     */
    public long credit_application_id;
    
    /**
     * 放款人id 
     */
    public long supervisor_id;
    
	/**
     *文件地址
     */
    public String file_url;
   
    /**
     *  添加时间
     */
    public Date time;
    
    /**是否已经付款；0-未付款；1-已付款*/
    public int is_payment;
    
    public  IsPayment getIsPayment()
    {
    	return IsPayment.getIsPayment(this.is_payment);
    }
    
    
    public enum IsPayment{
    	
    	/**
    	 * 未付款
    	 */
    	NO_PAY(0,"未付款"),
    	
    	/**
    	 *  已付款
    	 */
    	IS_PAY(1,"已付款"),
    	
    	;
    	
    	public int code;
    	public String value;
    	
    	private IsPayment(int code,String value)
    	{
    		this.code = code;
    		this.value = value;
    	}
    	
    	public static IsPayment getIsPayment(int code){
    		IsPayment [] is_payments = IsPayment.values();
    		for (IsPayment is_payment : is_payments) {
				if (is_payment.code == code) {
					return is_payment;
				}
			}
    		return null;
    	}
    	
    }
    
    /**加密ID*/
	@Transient
	public String sign;
	
    public String getSign () {
		return Security.addSign(this.id, Constants.BID_ID_SIGN, ConfConst.ENCRYPTION_KEY_DES);
	}
	
	
}
